package com.randomrpg.game

import java.util.Random

/**
 * An enemy
 */
abstract case class Enemy(override val clazz: RPGClass, elevel: Int) extends Player(clazz, "Enemy") {  
  
  override val name = this.getClass.getSimpleName
  
  1 until elevel foreach(i => clazz.levelUp(this))
  
  // enemies cannot be as strong as players
  attributes.str -= 2
  attributes.dex -= 2
  attributes.con -= 2
  attributes.int -= 2
  attributes.will -= 2
  maxLife -= (maxLife / 3)
  life = maxLife
}

object Enemy {
  private def rand = new Random
  
  def getRandom(level: Int): Enemy = rand.nextInt(10) match {
      case 0 => Orc(level)
      case 1 => Warlock(level)
      case 2 => DarkPriest(level)
      case 3 => Assassin(level)
      case 4 => Samurai(level)
      case 5 => Wizard(level)
      case 6 => Thief(level)
      case 7 => Pirate(level)
      case 8 => Ninja(level)
      case 9 => Shaman(level)
    }
}